<template>
  <div>
    <el-table
      border
      style="margin-bottom: 20px"
      :data="menuPermissionList"
      :expand-row-keys="expandKeys"
      row-key="id"
    >
      <el-table-column prop="name" label="名称"> </el-table-column>
      <el-table-column prop="code" label="权限值"> </el-table-column>
      <el-table-column prop="toCode" label="跳转权限值"> </el-table-column>
      <el-table-column label="操作">
        <template slot-scope="{ row, $index }">
          <el-button
            type="primary"
            icon="el-icon-plus"
            size="mini"
            title="添加菜单"
          ></el-button>
          <el-button
            type="primary"
            icon="el-icon-edit"
            size="mini"
            title="修改菜单"
          ></el-button>
          <el-button
            type="danger"
            icon="el-icon-delete"
            size="mini"
            title="删除"
          ></el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>
<script>
export default {
  data() {
    return {
      menuPermissionList: [], //表格数据源
      expandKeys: [], //需要自动展开的项
    };
  },
  mounted() {
    this.getFetchPermissionList();
  },
  methods: {
    async getFetchPermissionList() {
      const result = await this.$API.menu.getPermissionList();
      console.log(result, "菜单列表数据");
      if (result.code == 20000) {
        this.menuPermissionList = result.data.children;
      }
    },
  },
};
</script>i